{extend name="adminblue/base" /}
{block name="main"}
<div class="set-style">
	<dl>
		<dt><span style="color:red;margin-right:10px;">*</span>类型名称：</dt>
		<dd>
			<input id="class_name" type="text" class="input-common" />
		</dd>
	</dl>
	<dl>
		<dt>排序：</dt>
		<dd>
			<input id="sort" type="text" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')" class="input-common" />
		</dd>
	</dl>
	<dl>
		<dt></dt>
		<dd><button class="btn-common btn-big" onclick="setConfigAjax();">提交</button></dd>
	</dl>
</div>
<script>
function setConfigAjax(){
	var class_name = $("#class_name").val();
	var sort = $("#sort").val();
	if(class_name == ""){
		showMessage('error', "请输入类型名称");
		return;
	}
	$.ajax({
		type:"post",
		url:"{:__URL('ADMIN_MAIN/config/addhelpclass')}",
		data:{ 'class_name':class_name, 'sort':sort },
		success:function (data) {
			if (data["code"] > 0) {
				showMessage('success', data["message"],"{:__URL('ADMIN_MAIN/config/helpclass')}");
			}else{
				showMessage('error', data["message"]);
			}
		}
	});
}

function testSend(){
	var email_test = $("#email_test").val();
	$.ajax({
		type:"post",
		url:"{:__URL('ADMIN_MAIN/config/testsend')}",
		data:{
			'email_test':email_test,
		},
		success:function (data) {
			if (data["code"] > 0) {
				showMessage('success', data["message"]);
			}else{
				showMessage('error', data["message"]);
			}
		}
	});
}
</script>
{/block}